package com.llb666.shop.items.api.vo;

import com.llb666.shop.items.domain.entity.Category;
import lombok.Data;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * 二级分类VO.
 *
 * @author llb666
 */
@Data
public class CategoryVo {

    /**
     * Id
     */
    private Integer id;

    /**
     * 分类名称.
     */
    private String name;

    /**
     * 分类类型，一级分类，二级分类...
     */
    private String type;

    /**
     * 父级类别Id.
     */
    private Integer fatherId;

    /**
     * 三级分类vo list.
     */
    private List<SubCategoryVo> subCatList;

    @Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE)
    public interface Converter {
        CategoryVo.Converter INSTANCE = Mappers.getMapper(CategoryVo.Converter.class);

        CategoryVo do2Vo(Category category);

        List<CategoryVo> do2VoList(List<Category> carouselList);
    }
}
